package com.bac.rentmap.web.tag.user.review;

import java.io.IOException;
import java.util.Set;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;

import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;

public class UserReviewTag extends SimpleTagSupport {
    private Set<String> reviewers;

    @Override
    public void doTag() throws JspException, IOException {
      UserService userService = UserServiceFactory.getUserService();
      User user = userService.getCurrentUser();
      if (reviewers == null || user == null || !reviewers.contains(user.getEmail()) ) {
        getJspBody().invoke(null); 
      }
    }

    public Set<String> getReviewers() {
      return reviewers;
    }

    public void setReviewers(Set<String> reviewers) {
      this.reviewers = reviewers;
    }
}
